<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li>111</li>
        <li>222</li>
        <li>333</li>
    </ul>
    <button>删除li元素</button>

    <script>
        /* 
            需求：通过点击按钮来删除li标签
        */
        const btnObj = document.querySelector("button");
        const ulObj = document.querySelector("ul");
        /* 
            Node.removeChild() 方法从 DOM 中删除一个子节点。返回删除的节点。
        */
        btnObj.onclick = function () {
            ulObj.removeChild(ulObj.children[0]);
        }
    </script>
</body>

</html>